<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Coupon extends Model
{
    protected $table = 'coupons';

    protected $fillable = ['name', 'type', 'expired_at', 'discount', 'is_used', 'user_id'];

    protected $casts = [
        'is_used' => 'boolean'
    ];

    protected $dates = [
        'paid_at',
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

}
